/*
 * @Author: HotSuitor
 * @Date: 2020-03-12 12:26:36
 * @LastEditors: hs
 * @LastEditTime: 2020-03-12 12:34:09
 * @Description: hotsuitor@qq.com
 */
package main

import (
	"fmt"
)

func main() {
	nums := []int{1,2,3}
	sum := 0

	for i, num := range nums {
		if num == 3 {
			fmt.Printf("index:%d", i)
		}
	}

	for _, num := range nums {
		sum += num
		fmt.Printf("num=%d, sum=%d\n", num, sum)
	}

	kvs := map[string]string{"a":"apple", "b":"banana", "c":"chocolate"}
	for k, v := range kvs {
		fmt.Printf("key:%s, value:%s\n", k, v)
	}
}
